{include file="public/header"/}
<script src="{__PUBLIC_PATH}/common/js/jquery.js?v={$version}"></script>
<script src="{__PUBLIC_PATH}/admin/pcf/pcfcms.js?v={$version}"></script>
<link rel="stylesheet" href="{__PUBLIC_PATH}/admin/pcf/pcfcms.css?v={$version}"/>
</head>
<body>
<div class="layui-form">
<div class="layui-fluid" style="padding-bottom:83px;border:0;">
<div class="layui-col-sm12">
<div class="layui-card" style="box-shadow:0 0 0 0;">
    <div class="layui-card-body">
        <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <input type="hidden" id="id" name="id" value="{$info.id}">
            <div class="layui-form-item">
                <label class="layui-form-label"><b style="color:red;">*</b>任务标题</label>
                <div class="layui-input-inline wauto">
                  <input type="text" id="title" name="title" value="{$info.title}" class="layui-input" lay-verType="tips" lay-verify="required" required>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">最多执行</label>
                <div class="layui-input-inline wauto">
                  <input type="text" id="maxnum" name="maxnum" value="{$info.maxnum}" class="layui-input">
                </div>
                <div class="layui-input-inline auto gray lh38">0 表示没有限制</div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label"><b style="color:red;">*</b>开始时间</label>
                  <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="start_time" name="start_time" value="{$info.start_time}" placeholder="yyyy-MM-dd HH:mm:ss" lay-verType="tips" lay-verify="required" required>
                  </div>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-inline">
                  <label class="layui-form-label"><b style="color:red;">*</b>结束时间</label>
                  <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="stop_time" name="stop_time" value="{$info.stop_time}" placeholder="yyyy-MM-dd HH:mm:ss" lay-verType="tips" lay-verify="required" required>
                  </div>
                </div>
            </div>
            <div class="layui-form-item layui-form-text">
                <label class="layui-form-label">执行内容</label>
                <div class="layui-input-inline">
                  <textarea id="content" name="content"  class="layui-textarea">{$info.content}</textarea>
                </div>
            </div>
        </div>
        </div>
    </div>
    <div class="submit-info text-center">
        <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
    </div>
</div>
</div>
<div style="clear:both;"></div>
</div>
</div>
{include file="public/footer"/}
<script>
layui.use('form', function(){
    var $ = layui.$,
        layer = layui.layer,
        form = layui.form;
        //监听提交
        form.on('submit(formSubmit)', function(data){
            layer.load(2);
            $.ajax({
                type : 'post',
                url : "{:url('/task/edit')}",
                data : data.field,
                dataType : 'json',
                success : function(res){
                    layer.closeAll('loading');
                    if(0 === res.code){
                        layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                            parent.window.location.href = res.url;
                        });
                    }else{
                        layer.msg(res.msg, {icon: 2, time: 1000});
                    }
                },
                error: function(e){
                    layer.closeAll('loading');
                    layer.msg("未知错误，操作中断！", {icon: 2, time: 1000});
                }
            });
            return false;
        });
        //日期时间选择器
        laydate.render({
           elem: '#start_time',type: 'datetime'
        });
        //日期时间选择器
        laydate.render({
           elem: '#stop_time',type: 'datetime'
        });
});
</script>
</body>
</html>